home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group97b.txt
/
000119_icon-group-sender _Wed Nov 12 16:24:56 1997.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
2KB
Return-Path: <icon-group-sender>
Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
by baskerville.CS.Arizona.EDU (8.8.7/8.8.7) with SMTP id QAA07678
for <icon-group-addresses@baskerville.CS.Arizona.EDU>; Wed, 12 Nov 1997 16:24:56 -0700 (MST)
Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
id AA08248; Wed, 12 Nov 1997 16:24:55 -0700
Sender: rpereda@ringer.cs.utsa.edu
Message-Id: <346A07C2.4CAC@cs.utsa.edu>
Date: Wed, 12 Nov 1997 13:47:14 -0600
From: Ray Pereda <rpereda@ringer.cs.utsa.edu>
X-Mailer: Mozilla 3.0 (X11; I; SunOS 5.5 sun4m)
Mime-Version: 1.0
To: Chris Lusena <lusena@cs.uky.edu>
Cc: icon-group@optima.CS.Arizona.EDU
Subject: Re: Regular Expressions
References: <Pine.LNX.3.95.971110105527.10736A-100000@uther.cs.engr.uky.edu>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Errors-To: icon-group-errors@optima.CS.Arizona.EDU
Status: RO
Chris,
There is an excellent regular expression kit in the
Icon Programming Library written by Robert Alexander.
Look for the file regexp.icn. Here is an example that
extracts all the numbers from a text file:
link regexp
procedure main()
text := ""
while text ||:= read()
num_pattern := "\\d+(\\.\\d+)?"
text ? {
while tab(ReFind(num_pattern)) do {
number := tab(ReMatch(num_pattern))
write(number)
}
}
end
-ray
Chris Lusena wrote:
>
> For part of a class project I need/like to be able to find all
> occanses of a Regular Expression in a ASCII file. Icon seams that is might
> be good for this, since one can fine all occurance of a word easly.
>
> So how would one go about this? I'd like to be able to serach for the Reg.
> Exp. over line breaks if possable.
>
> Thanks in advance foryou time and help.
>
> --Chris Lusena U of Kentucky, Dept. of Com. Sci.
> Just a plain boring .SIG, eh? Lexington, Kentucky, U.S.A.
> email: Lusena@cs.engr.uky.edu #include<standard disclaimer>
> and for the webbies out there: http://www.cs.engr.uky.edu/~lusena/